package com.neuedu.api.usestring;

/**
 * @author 金山
 * 项目：javase
 * site: https://blog.fulfill.com.cn
 * 描述  \
 * @data 2024/10/249:11
 */
public class StringJVM {

    public static void main(String[] args) {



        //jvm的常量折叠
        int numa = 2+3;
        String str1 = "abcdef";

        // 字面量的加法  在编译阶段 编译器进行了优化
        String str2 = "abc" + "def";
        String str3 = "abc" + new String("def");

        System.out.println("str1 = " + str1);
        System.out.println("str2 = " + str2);
        System.out.println("str3 = " + str3);

        System.out.println("numa = " + numa);

        System.out.println("str1 == str2 = " +( str1 == str2));  //true
        System.out.println("str1 == str3 = " +( str1 == str3));  //true


    }
}
